package top.makeprogress.taobaospider.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

/**
 * @author liuyi
 * @create 2019-10-11 19:49
 **/

public class DateUtils {

    public static String toGMTFormat(Date date){
        Calendar cd = Calendar.getInstance();
        cd.setTimeInMillis(date.getTime());
        SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss 'GMT'", Locale.US);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        return sdf.format(cd.getTime());
    }
}